home *** CD-ROM | disk | FTP | other *** search
Text File | 1993-06-05 | 15.6 KB | 424 lines | [TEXT/MACA] |
- "Script Stripper 2.0" HyperCard script extractor.
- ©1992, 1993. Donald J. Winiecki, all rights reserved.
- ∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞
-
- • Name of Stack: "Script Stripper v2.0"
- • Size of Stack: 31.36 KB.
- • Free Space in Stack: 0 KB.
- • User Level of Stack: 5; "Scripting"
-
- • Date of Stripping: Saturday, June 5, 1993
- • Time of Stripping: 7:09 PM
-
- ◊ ◊ Starting scripts of Stack: "Script Stripper v2.0" ◊ ◊
-
- • • Script of Stack: "Script Stripper v2.0" • •
- _____________________________________________________
- 2.0
-
- on openStack
- hide menuBar
- aboutTheStripper
- put line 1 of script of this stack into bg fld "the version of"
- end openStack
-
- on closeStack
- show menuBar
- end closeStack
-
- on aboutTheStripper
- put "About Script Stripper..." into menuItem 1 of menu "Apple" with ¬
- menuMsg "about"
- end aboutTheStripper
-
- on about
- -- use "Hard Spaces" (eg: <Option-Space>) to create formatted
- -- output in a dialog box
- answer " ""e&"Script Stripper,""e&&"a HyperCard script"¬
- &&" extraction utility."¬
- &&" _____________________________________"¬
- &&" ©1993, Donald J. Winiecki"¬
- &&" 5202 Bangor Ave., H 204"¬
- &&" Lubbock, TX. 79414"¬
- &&" {806} 792-5253" with "More..." or "Done"
- if it = "More..." then
- lock screen
- show cd fld "Stripper Help"
- show cd btn "Hide Stripper Help"
- set the hilite of cd btn "Hide Stripper Help" to true
- set the scroll of cd fld "Stripper Help" to 533 -- go to specific point in "Help" field
- unlock screen with scroll down
- end if
- end about
-
- on checkIfCompactNeeded
- -- keep the stack lean (copying & moving text builds LOTS of freespace)
- -- this handler is from pp. 207 of "The Complete Book of HyperTalk 2, by Dan Shafer
- put size of this stack into stackSize
- put freeSize of this stack into freeSpace
- if freeSpace > (.3 * stackSize) then -- if freeSpace exceeds 30% of stack's size
- answer " ""e&"Script Stripper""e&&"should be compacted"¬
- &&" before we continue." with "Ok"
- doMenu "Compact Stack"
- end if
- end checkIfCompactNeeded
-
- on whereItsSaved
- global thisStack, stackNameTruncated_G
- if stackNameTruncated_G is not empty then
- -- if the ".strip" file name had to be truncated •• (6/5/93)
- answer "Scripts for:"&"e&stackNameTruncated_G"e&&"have been saved in"¬
- &&"the"&"e&"~Script Stripper Textfiles""e&&"folder"¬
- &&"as:"&"e&stackNameTruncated_G&".strip.""e with "Oh Boy !"
- else
- answer "Scripts for:"&"e&thisStack"e&&"have been saved in"¬
- &&"the"&"e&"~Script Stripper Textfiles""e&&"folder"¬
- &&"as:"&"e&thisStack&".strip.""e with "Oh Boy !"
- end if
- end whereItsSaved
-
- function underScore
- -- declare and use a function instead of typing this thing every time
- return "_____________________________________________________"
- end underScore
-
- on retrieveStackScript
- global thisStack_G, thisStack, stackNameTruncated_G
- push card -- remember where to come back to
- put empty into thisStack
- put empty into thisStack_G
- put empty into stackNameTruncated_G
-
- -- find the short name of the "Script Stripper"
- repeat with i = number of chars in long name of this stack down to 1
- set cursor to busy
- -- keep the last item in the path statement
- if char i of long name of this stack = ":" then exit repeat
- put char i of long name of this stack before temp
- end repeat
-
- -- establish the path to where the "Stripped" script will be stored {stored in 'filePath'}
- -- (!!!!user should not change file/folder names or location of the "...Textfiles" folder)
- repeat with i = 8 to (number of chars in long name of this stack - (number of chars in temp + 1))
- set cursor to busy
- put char i of long name of this stack after filePath
- end repeat
-
- -- request user to maneuver to and identify stack to be stripped
- -- full path to the desired stack is put into "it"
- answer file "Strip which stack's scripts ?" of type "STAK"
-
- -- if user decides not to do it then bail out...
- if it is empty then
- answer " Script Stripping Operation Aborted!" with "Whew !"
- exit retrieveStackScript
- end if
-
- -- store the full path name of the stack to be stripped into global variable 'thisStack_G'
- put it into thisStack_G
-
- -- establish the name of the textfile to be created for this stripping session
- repeat with i = number of chars in thisStack_G down to 1
- set cursor to busy
- if char i of thisStack_G = ":" then exit repeat
- put char i of thisStack_G before thisStack
- end repeat
-
- -- write my tag line into the holder variable (strippingHolder)
- put quote&"Script Stripper"&&line 1 of script of this stack"e&&"HyperCard"¬
- &&"script extractor."&return&"©1992, 1993. Donald J. Winiecki, all rights reserved."&return ¬
- &"∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞"&return&return into strippingHolder
-
- set lockMessages to true
- lock screen
- go stack thisStack_G
-
- -- write the selected stack's script after holder variable
- put "• Name of Stack:"&"e&thisStack"e&return after strippingHolder
-
- -- write some stack statistics
- put the userLevel into it
- if it = 1 then put "1;"&"e&"Browsing""e into it
- if it = 2 then put "2;"&"e&"Typing""e into it
- if it = 3 then put "3;"&"e&"Painting""e into it
- if it = 4 then put "4;"&"e&"Authoring""e into it
- if it = 5 then put "5;"&"e&"Scripting""e into it
- put "• Size of Stack:"&&size of this stack / 1000&&"KB."&return after strippingHolder
- put "• Free Space in Stack:"&&the freeSize of this stack / 1000&&"KB."&return after strippingHolder
- put "• User Level of Stack:"&&it&return&return after strippingHolder
- put "• Date of Stripping:"&&the long date&return after strippingHolder
- put "• Time of Stripping:"&&the time&return&return after strippingHolder
- put "◊ ◊ Starting scripts of Stack:"&"e&thisStack"e&" ◊ ◊"&return&return after strippingHolder
- put "• • Script of Stack:"&"e&thisStack"e&" • •"&return after strippingHolder
- put underScore()&return after strippingHolder
- if script of stack thisStack_G is not empty then
- put script of stack thisStack_G after strippingHolder
- else
- put "* No script at the Stack Level" after strippingHolder
- end if
- put return&return after strippingHolder
-
- go to first cd of stack thisStack_G
-
- repeat with i = 1 to the number of bgs
- go bg i
- set cursor to busy
- put empty into j
- put empty into k
-
- put "• ◊ Scripts of Background"&&i&";"&"e&short name of this bg¬
- "e&return after strippingHolder
- put underScore()&return after strippingHolder
- if script of bg i is empty then
- put "* No script for this Background" after strippingHolder
- else
- put script of bg i after strippingHolder
- end if
- put return&return after strippingHolder
-
- repeat with k = 1 to number of bg btns
- set cursor to busy
- put "• Script of Background Button:"&&k&";"&"e&short name of bg btn k¬
- "e&&"of Background"&&i&return after strippingHolder
- put underScore()&return after strippingHolder
- if script of bg btn k is empty then
- put "* No script for this Background Button" after strippingHolder
- else
- put script of bg btn k after strippingHolder
- end if
- put return&return after strippingHolder
- end repeat
-
- repeat with j = 1 to number of bg flds
- set cursor to busy
- put "• Script of Background Field"&&j&";"&"e&short name of bg fld j¬
- "e&&"of Background"&&i&return after strippingHolder
- put underScore()&return after strippingHolder
- if script of bg fld j is empty then
- put "* No script for this Background Field" after strippingHolder
- else
- put script of bg fld j after strippingHolder
- end if
- put return&return after strippingHolder
- end repeat
-
- repeat with L = 1 to number of cds of bg i
- go cd L of bg i
- put empty into m
- put empty into n
-
- set cursor to busy
- put "• Script of Card:"&&L&";"&"e&short name of cd L of this bg¬
- "e&&"of Background"&&i&return after strippingHolder
- put underScore()&return after strippingHolder
- if script of cd L of this bg is empty then
- put "* No script for this Card" after strippingHolder
- else
- put script of cd L of this bg after strippingHolder
- end if
- put return&return after strippingHolder
-
- repeat with n = 1 to number of cd btns
- set cursor to busy
- put "• Script of Card Button:"&&n&";"&"e&short name of cd btn n¬
- "e&&"of Card"&&L&&"of Background"&&i&return after strippingHolder
- put underScore()&return after strippingHolder
- if script of cd btn n is empty then
- put "* No script for this Card Button" after strippingHolder
- else
- put script of cd btn n after strippingHolder
- end if
- put return&return after strippingHolder
- end repeat
-
- repeat with m = 1 to number of cd flds
- set cursor to busy
- put "• Script of Card Field:"&&m&";"&"e&short name of cd fld m¬
- "e&&"of Card"&&L&&"of Background"&&i&return after strippingHolder
- put underScore()&return after strippingHolder
- if script of cd fld m is empty then
- put "* No script for this Card Field" after strippingHolder
- else
- put script of cd fld m after strippingHolder
- end if
- put return&return after strippingHolder
- end repeat
- end repeat
- end repeat
-
- -- stacks with long names cause problems with "Script Stripper"
- -- at this point in the handler. The handler has therefore been
- -- designed to truncate long script names and store the stripped file
- -- using a shortened version of the original stack name (the original
- -- stack's name is not changed). •• (6/5/93)
-
- if the number of chars in thisStack > 27 then -- file names limited to 31 char's here
- put the number of chars in thisStack into nameThisLong
- put char 1 to 10 of thisStack into stackNameTruncated_G
- put "..." after stackNameTruncated_G
- put char (nameThisLong - 10) to nameThisLong of thisStack after stackNameTruncated_G
- end if
-
- -- write the variable contents to the textfile named for the stack
- if stackNameTruncated_G is not empty then -- if the stack name was too long
- open file filePath&":"&"~Script Stripper Textfiles"&":"&stackNameTruncated_G&".strip"
- write strippingHolder to file filePath&":"&"~Script Stripper Textfiles"&":"&stackNameTruncated_G&".strip"
- close file filePath&":"&"~Script Stripper Textfiles"&":"&stackNameTruncated_G&".strip"
- else
- open file filePath&":"&"~Script Stripper Textfiles"&":"&thisStack&".strip"
- write strippingHolder to file filePath&":"&"~Script Stripper Textfiles"&":"&thisStack&".strip"
- close file filePath&":"&"~Script Stripper Textfiles"&":"&thisStack&".strip"
- end if
-
- pop card -- come back to where we left
- unlock screen
-
- if the number of chars in strippingHolder < 29900 then
- -- only 30000 characters can be held in a HyperCard field
- answer "Would you like to view the scripts for stack:"&"e&thisStack"e¬
- &&"now?" with "Later" or "Yes"
- if it = "Yes" then
- lock screen
- show cd pict
- repeat with i = 1 to (number of cd btns - 1)
- -- show all buttons except "Hide Help"
- show cd btn i
- end repeat
- show bg fld "Editing Field"
- hide bg btn "Go Home"
- put strippingHolder into bg fld "Editing Field"
- unlock screen with barn door open
- else
- whereItsSaved
- end if
- else
- answer "The scripts for"&"e&thisStack"e&&"are"¬
- &&"too long to view within the Script Stripper, use TeachText or your"¬
- &&"word processor to open the file instead." with "Okay"
-
- -- tell the user where the textfiles are saved
- whereItsSaved
- end if
-
- set lockMessages to false
- end retrieveStackScript
-
- • ◊ Scripts of Background 1; "Stripper bg 1"
- _____________________________________________________
- * No script for this Background
-
- • Script of Background Button: 1; "Help" of Background 1
- _____________________________________________________
- on mouseUp
- lock screen
- show cd btn "Hide Stripper Help"
- hide cd btn "Done Viewing"
- hide cd btn "Print Scripts"
- hide bg btn "Info"
- hide bg btn "Help"
- set the hilite of cd btn "Hide Stripper Help" to true
- show cd fld "Stripper Help"
- unlock screen with scroll down
- end mouseUp
-
- • Script of Background Button: 2; "Go Home" of Background 1
- _____________________________________________________
- on mouseUp
- checkIfCompactNeeded
- go home
- end mouseUp
-
- • Script of Background Button: 3; "Info" of Background 1
- _____________________________________________________
- on mouseUp
- about
- end mouseUp
-
- • Script of Background Button: 4; "Load A Script" of Background 1
- _____________________________________________________
- on mouseUp
- retrieveStackScript
- end mouseUp
-
- • Script of Background Field 1; "the version of" of Background 1
- _____________________________________________________
- * No script for this Background Field
-
- • Script of Background Field 2; "Editing Field" of Background 1
- _____________________________________________________
- * No script for this Background Field
-
- • Script of Card: 1; "Stripper cd 1" of Background 1
- _____________________________________________________
- * No script for this Card
-
- • Script of Card Button: 1; "Done Viewing" of Card 1 of Background 1
- _____________________________________________________
- on mouseUp
- global thisStack
- whereItsSaved
- lock screen
- repeat with i = 1 to (number of cd btns - 1)
- -- hide all card buttons except "Hide Help"
- hide cd btn i
- end repeat
- hide cd pict
- hide bg fld "Editing Field"
- show bg btn "Go Home"
- set the scroll of bg fld "Editing Field" to 0
- put empty into bg fld "Editing Field"
- unlock screen with barn door close
- checkIfCompactNeeded
- end mouseUp
-
- • Script of Card Button: 2; "Print Scripts" of Card 1 of Background 1
- _____________________________________________________
- on mouseUp
- print bg fld "Editing Field"
- end mouseUp
-
- • Script of Card Button: 3; "scroll up" of Card 1 of Background 1
- _____________________________________________________
- on mouseStillDown
- set the hilite of me to true
- set the scroll of bg fld "Editing Field" to¬
- (scroll of bg fld "Editing Field" - (3 * textSize of bg fld¬
- "Editing Field"))
- end mouseStillDown
-
- • Script of Card Button: 4; "scroll down" of Card 1 of Background 1
- _____________________________________________________
- on mouseStillDown
- set the hilite of me to true
- set the scroll of bg fld "Editing Field" to¬
- (scroll of bg fld "Editing Field" + (3 * textSize of bg fld¬
- "Editing Field"))
- end mouseStillDown
-
- • Script of Card Button: 5; "Hide Stripper Help" of Card 1 of Background 1
- _____________________________________________________
- on mouseUp
- set the hilite of me to not the hilite of me
- lock screen
- hide cd fld "Stripper Help"
- hide cd btn "Hide Stripper Help"
- if the visible of bg fld "Editing Field" is true then
- show cd btn "Print Scripts"
- show cd btn "Done Viewing"
- end if
- show bg btn "Info"
- show bg btn "Help"
- -- return to the beginning of the field
- set the scroll of cd fld "Stripper Help" to 0
- unlock screen with scroll up
- end mouseUp
-
- • Script of Card Field: 1; "Stripper Help" of Card 1 of Background 1
- _____________________________________________________
- -- It's usually a good idea to use "default" fonts for your fields.
- -- If you set them to "fancy fonts" some user's (whose machines
- -- don't have your font installed) won't be able to see the stack
- -- as you've intended. In some cases, the copy will become difficult
- -- to read because the Macintosh tries to "estimate" the unknown font. d.j.w.
-
-